<template>
  <Dialog
    width="430px
    "
    :show-close="false"
    :close-on-click-model="false"
    :title="title"
    :visible.sync="visible"
  >
    <div>{{ message }}</div>
    <div slot="footer">
      <Button
        @click="
          visible = false;
          $emit('cancel');
        "
        >取消</Button
      >
      <Button
        :loading="confirmLoading"
        @click="
          confirmLoading = true;
          $emit('ok');
        "
        >确认</Button
      >
    </div>
  </Dialog>
</template>
<script>
import { Dialog, Button } from "element-ui";

export default {
  name: "MyConfirm",
  components: {
    Dialog,
    Button,
  },
  props: {
    /**
     *标题
     */
    title: String,
    /**
     *消息
     */
    message: String,
  },
  data() {
    return {
      visible: false,
      confirmLoading: true,
    };
  },
  methods: {
    /**
     * 关闭
     * */
    close() {
      this.visible = false;
    },
  },
  mounted() {
    this.visible = true;
  },
};
</script>
<style lang="scss">
</style>